import Vue from 'vue'
import VueRouter from 'vue-router'
import navData from './navData'
const { topNav, leftNav } = navData

// 抓取 Router 重复点击报错
const originalPush = VueRouter.prototype.push
console.log(originalPush)
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const router = new VueRouter({
  base: process.env.BASE_URL,
  mode: 'hash',
  routes: [...topNav, ...leftNav]
})

export default router
